package com.ruoyi.web.controller.platform;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.platform.domain.MMonitoringEquipment;
import com.ruoyi.platform.domain.request.InspectionLedgerRequest;
import com.ruoyi.platform.domain.vo.InspectionLedgerVo;
import com.ruoyi.platform.service.IInspectionLedgerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @program: RuoYi-Vue
 * @description: 台账服务相关
 * @author: drgon
 * @create: 2025-9-18 03：38
 */
@RestController
@RequestMapping("/platform/ledger")
public class LedgerController extends BaseController {
    @Autowired
    private IInspectionLedgerService service;

    /**
     * 查询【巡检台帐】列表
     */
    @PreAuthorize("@ss.hasPermi('platform:ledger:list')")
    @GetMapping("/list")
    public TableDataInfo list(InspectionLedgerRequest request) {
        startPage();
        List<InspectionLedgerVo> list = service.selectInspectionLedgerList(request);
        return getDataTable(list);
    }
    /**
     * 导出【巡检台帐】列表
     */
    @PreAuthorize("@ss.hasPermi('platform:equipment:export')")
    @Log(title = "【导出【监控设备】列表】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InspectionLedgerRequest request)
    {
        List<InspectionLedgerVo> list = service.selectInspectionLedgerList(request);
        ExcelUtil<InspectionLedgerVo> util = new ExcelUtil<InspectionLedgerVo>(InspectionLedgerVo.class);
        util.exportExcel(response, list, "【监控设备】数据");
    }

}
